//表单验证错误提示
const showValidateModal = (error) => {
  wx.showModal({ content: error.msg, showCancel: false });
};
//判断当前用户是否已授权登录
const cklogin = (userInfo) => {
  return new Promise((resolve, reject) => {
    if (!userInfo) {
      wx.showModal({
        title: "提示",
        content: "请先授权登录",
        showCancel: false,
      }).then((res) => {
        if (res.confirm) {
          wx.switchTab({ url: "/pages/user/person/person" });
        }
      });
      resolve(false);
    } else {
      resolve(true);
    }
  });
};
module.exports = {
  showValidateModal,
  cklogin,
};
